#!/usr/bin/env bash


###################
CONTAINERD_VERSION='1.6.*'
KUBE_VERSION='1.28.*'


dnf install -y iproute-tc

## centos8 自带安装podman
yum remove podman -y

######### 安装 containerd ##########
source <(curl -sL https://gitee.com/bigbigwood/infra/raw/master/k8s/containerd/containerd.sh)

## 安装 kubernetes
cat > /etc/yum.repos.d/kubernetes.repo <<EOF
[kubernetes]
name=kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
EOF

dnf -y install kubeadm-${KUBE_VERSION} kubectl-${KUBE_VERSION} kubelet-${KUBE_VERSION} cri-tools

cat > /etc/sysconfig/kubelet <<EOF
KUBELET_EXTRA_ARGS="--cgroup-driver=systemd"
EOF

# 配置开启自启
#systemctl daemon-reload && systemctl enable kubelet
systemctl enable --now kubelet.service